package com.fenshi.manager.fragment;

import android.os.Bundle;
import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v7.widget.RecyclerView;

import com.fenshi.manager.R;
import com.fenshi.manager.adapter.ListViewAdapter;
import com.quickdv.activity.fragment.BaseFragment;
import com.quickdv.activity.view.CustomListView;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 *
 * 申请锁车订单
 * Created by Administrator on 2015/7/6.
 */
public class OrderFragment2 extends BaseFragment {
    // the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
    private static final String ARG_PARAM1 = "type";

    private SwipeRefreshLayout refreshLayout;
    private RecyclerView recycler;

    private CustomListView list;
    private List<Map<String, Object>> data;

    /**
     * Use this factory method to create a new instance of
     * this fragment using the provided parameters.
     *
     * @param param1 Parameter 1.
     * @return A new instance of fragment OrderFragment.
     */
    // TODO: Rename and change types and number of parameters
    public static OrderFragment2 newInstance(int param1) {
        OrderFragment2 fragment = new OrderFragment2();
        Bundle args = new Bundle();
        args.putInt(ARG_PARAM1, param1);
        fragment.setArguments(args);
        return fragment;
    }


    @Override
    public void onDetach() {
        super.onDetach();
        mListener = null;
    }

    @Override
    protected void initView() {
//        refreshLayout = findView(R.id.order_refreshlayout);
        list = findView(R.id.order_list);

        buildData();
        orderType(R.layout.fragment_order_detail);

    }

    private void orderType(int layout) {
//        MRecyclerAdapter adapter = new MRecyclerAdapter(getActivity(), data, layout, new String[]{}, new int[]{}) {
//            @Override
//            public void addClickListener(DataViewHolder holder, int position) {
//                //添加具体点击实现
//                holder.getRootView().setOnClickListener(new View.OnClickListener() {
//                    @Override
//                    public void onClick(View view) {
//                        if(activity !=null) {
//                            Intent intent = new Intent(activity, BackActivity.class);
//                            startActivity(intent);
//                        }
//                    }
//                });
//            }
//        };
//        recycler.setAdapter(adapter);
//        MLinearLayoutManager manager = new MLinearLayoutManager(getActivity());
//        manager.setOrientation(LinearLayout.VERTICAL);
//        manager.setSmoothScrollbarEnabled(true);
//        recycler.setLayoutManager(manager);


        ListViewAdapter adapter = new ListViewAdapter(activity,data,layout,new String[]{},new int[]{});
        list.setAdapter(adapter);
    }

    @Override
    public void setCLickListener() {

    }


    @Override
    protected int getLayoutViewID() {
        return R.layout.activity_order_fragment;
    }

    private void buildData() {
        data = new ArrayList<>();
        for (int i = 0; i < 1; i++) {
            Map<String, Object> map = new HashMap<>();
            data.add(map);
        }
    }

}
